#include <iostream>
#include <unistd.h>
#include "Thread.hpp"

void hello1()
{
    char buffer[64];
    pthread_getname_np(pthread_self(),buffer,sizeof(buffer)-1);
    for(int i=0;i<10;i++)
    {
        std::cout<<"hello world "<<buffer<<std::endl;
        sleep(1);
    }
}

void hello2()
{
    char buffer[64];
    pthread_getname_np(pthread_self(),buffer,sizeof(buffer)-1);
    for(int i=0;i<10;i++)
    {
        std::cout<<"hello world "<<buffer<<std::endl;
        sleep(1);
    }
}



int main()
{
    pthread_setname_np(pthread_self(),"main");
    ThreadMouble::Thread t1(hello1);
    t1.Start();

    ThreadMouble::Thread t2(std::bind(&hello2));
    t2.Start();


    t1.Join();
    t2.Join();
    
    return 0;
}